package sv.ues.fia.clases;

import java.util.List;

import sv.ues.fia.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import android.app.Activity;


public class NotifyListItemAdapter extends ArrayAdapter<NotifyListItem> {
	Context context; 
	List<NotifyListItem> asisteEvento;

	public NotifyListItemAdapter(Context context,
			List<NotifyListItem> data) {
		super(context, android.R.layout.simple_list_item_1, data);
		this.context = context;
		this.asisteEvento = data;

	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		View row = convertView;
		WeatherHolder holder = null;

		if(row == null)
        {
            LayoutInflater inflater = ((Activity)context).getLayoutInflater();
            row = inflater.inflate(R.layout.listview_notify_row, parent, false);

			holder = new WeatherHolder();
            holder.idTG = (TextView)row.findViewById(R.id.idTGItem);
            holder.ubicacion = (TextView)row.findViewById(R.id.ubicacionItem);
            holder.fecha = (TextView)row.findViewById(R.id.fechaItem);
           
            row.setTag(holder);
		} else {
			holder = (WeatherHolder) row.getTag();
		}
		NotifyListItem weather = asisteEvento.get(position);
        holder.idTG.setText(weather.getIdTG());
        holder.ubicacion.setText(weather.getUbicacion());
        holder.fecha.setText(weather.getFecha());
       
        return row;
	}
	
	static class WeatherHolder
    {
        TextView idTG;
        TextView ubicacion;
        TextView fecha;
    }
}